﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;

namespace Icoders.MarketTracker.Core.Validation
{
   public static class ValidationExtensions
    {
       public static ValidationResultInfo BasicValidation<T>(this T objToValidate)
       {
           ValidationContext vt = new ValidationContext(objToValidate, null, null);
           List<ValidationResult> result = new List<ValidationResult>();
           Validator.TryValidateObject(objToValidate, vt, result, true);
           return new ValidationResultInfo {Results = result};
       }
    }
}
